<template>
  <div
    class="cus__tag__container"
    :class="[status ? 'is__success' : 'is__error']"
  >
    <slot>
      <span>{{ status ? successText : errorText }}</span>
    </slot>
  </div>
</template>

<script lang="ts">
export default {
  name: 'cus-tag',
  props: {
    status: {
      type: [Boolean, Number],
      default: () => false
    },
    successText: String,
    errorText: String
  }
}
</script>

<style lang="scss" scoped>
.cus__tag__container {
  display: inline-block;
  padding: 0 15px 0 20px;
  height: 24px;
  line-height: 24px;
  border-radius: 3px;
  position: relative;
  &.is__success {
    color: #74c874;
    background: #f2f2f2;
    &::before {
      background: #74c874;
    }
  }
  &.is__error {
    color: #fc514f;
    background: #ffefeb;
    &::before {
      background: #fc514f;
    }
  }
  &::before {
    content: "";
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 12px;
    margin-top: -2px;
  }
}
</style>